﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using seiacpscs.sortalgorithms;

namespace seiacpscs_test.sortalgorithms
{
    [TestClass]
    public class BubbleSortTestCase
    {
       
       
        [TestMethod]
    	public void TestSortWithEmptyArray() {
		
		    int [] items = {};
		
		    SortAlgorithm algorithm = SortAlgorithmFactory.BubbleSort;
		
		    algorithm.Sort(items);
		
		    Assert.AreEqual(items.Length, 0);
		
	    }

        [TestMethod]
        public void testSortwithOneItem()
        {

            int[] items = { 5 };

            SortAlgorithm algorithm = SortAlgorithmFactory.BubbleSort;

            algorithm.Sort(items);


            Assert.AreEqual(items[0], 5);

        }

        [TestMethod]
	    public void testSortwithTwoItems() {
		
		    int [] items = {5,1};
		
		    SortAlgorithm algorithm = SortAlgorithmFactory.BubbleSort;
		
		    algorithm.Sort(items);
		
		
		    Assert.AreEqual(items[0], 1);
		    Assert.AreEqual(items[1], 5);
		
    	}

        [TestMethod]
        public void testSort()
        {

            int[] items = { 5, 1, 4, 2, 8 };

            SortAlgorithm algorithm = SortAlgorithmFactory.BubbleSort;

            algorithm.Sort(items);

            Assert.AreEqual(items[0], 1);
            Assert.AreEqual(items[1], 2);
            Assert.AreEqual(items[2], 4);
            Assert.AreEqual(items[3], 5);
            Assert.AreEqual(items[4], 8);
        }


    }
}
